<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Scuola Media E. d'Arborea - Lamarmora </title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<meta name="description" content="Il sito della scuola secondaria superiore di Iglesias, in Sardegna" />
<meta name="keywords" content="scuola, iglesias, didattica, insegnamento, docenti" />
<link rel="stylesheet" href="andreas08.css" type="text/css" media="screen,projection" />
<?php include $_ENV["DOCUMENT_ROOT"]."/js/prototype.php" ?>
<script type="text/javascript">
function show_t(div){
	if($(div).style.display == "none")
		Effect.Appear(div, { duration: 1.0 });
	else
		Effect.Fade(div, { duration: 1.0 });
}

function _submit(form){
	// stringhe permessi
	<?php 
	$perms_string = strval(DOC_PERM);
	?>
	var perms = new Array(0, <?php print DOC_PERM ?>, <?php print DOC_PERM ?>, <?php print DOC_PERM ?>, <?php print DOC_PERM ?>, <?php print DOC_PERM ?>, <?php print DOC_PERM ?>, <?php print DOC_PERM ?>, <?php print DOC_PERM ?>);
	// permessi
	var parents = <?php print GEN_PERM ?>;
	var students = <?php print STD_PERM ?>;
	var ata = <?php print ATA_PERM ?>;
	for(i = 1; i < 9; i++){
		if($('par'+i).checked)
			perms[i] += parents;
		if($('stu'+i).checked)
			perms[i] += students;
		if($('ata'+i).checked)
			perms[i] += ata;
	}
	$('perms').value = perms.join(",");
	var req = new Ajax.Request('profile_manager.php',
			  {
			    	method:'post',
			    	parameters: $('profile_form').serialize(true),
			    	onSuccess: function(transport){
			      		var response = transport.responseText || "no response text";
			      		var dati = response.split("#");
			     		if(dati[0] == "ko"){
				     		alert("Impossibile completare l'operazione richiesta. Riprovare tra qualche secondo o segnalare l'errore al webmaster");
				     		return;
			     		}
			     		else{
			     			alert("Operazione completata con successo");
			     		}
			    	},
			    	onFailure: function(){ alert("Si e' verificato un errore..."); }
			  });
}

</script>
<style type="text/css">
input { font-size: 11px }
</style>
</head>
<body>
<div id="container" >
<div id="header">
<h1>Scuola Media E. d'Arborea - Lamarmora</h1>
<h2>area riservata ai docenti</h2>
</div>
<?php include "navigation.php" ?>
<div id="content">
<h2 style="text-align: center">Gestisci i tuoi dati personali</h2>
<form action="profile_manager.php" method="post" id="profile_form">
<table style="width: 50%; float: left">
<tr>
<td style="">
<div class="field" id="field1">
	<a href="#" onclick="show_t($('pfield1'))" style="font-weight: bolder; font-size: 12px; background-color: #467aa7; height: 12px; color: white">+</a>
	<span style="font-weight: bold; padding-right: 10px">Data di nascita</span>
	<input type="text" style="border: 1px solid gray; width: 175px; float: right" name="birthday" value="<?php if(isset($birthday)) print $birthday ?>" />
	<div style="display: none; padding-top: 5px" id="pfield1">Visibile per...
	<table style="width: 95%; margin-top: 5px; margin-left: auto; margin-right: auto">
	<tr>
		<td style="width: 70%; border-bottom: 1px dotted">Genitori</td>
		<td style="width: 30%; text-align: right; border-bottom: 1px dotted"><input type="checkbox" id="par1" value="<?php print GEN_PERM ?>" <?php if(isset($birthday_perms)){ if($birthday_perms&GEN_PERM) print "checked='checked'"; } ?> /></td>
	</tr>
	<tr>
		<td style="width: 70%; border-bottom: 1px dotted">Studenti</td>
		<td style="width: 30%; text-align: right; border-bottom: 1px dotted"><input type="checkbox" id="stu1" value="<?php print STD_PERM ?>" <?php if(isset($birthday_perms)){ if($birthday_perms&STD_PERM) print "checked='checked'"; } ?> /></td>
	</tr>
	<tr>
		<td style="width: 70%; border-bottom: 1px dotted">ATA</td>
		<td style="width: 30%; text-align: right; border-bottom: 1px dotted"><input type="checkbox" id="ata1" value="<?php print ATA_PERM ?>" <?php if(isset($birthday_perms)){ if($birthday_perms&ATA_PERM) print "checked='checked'"; } ?> /></td>
	</tr>
	</table>
	</div>
</div>
</td>
</tr>
<tr>
<td style="">
<div class="field" id="field2">
	<a href="#" onclick="show_t($('pfield2'))" style="font-weight: bolder; font-size: 12px; background-color: #467aa7; height: 12px; color: white">+</a>
	<span style="font-weight: bold; padding-right: 10px">Indirizzo</span>
	<input type="text" style="border: 1px solid gray; width: 175px; float: right" name="address" value="<?php if(isset($address)) print $address ?>" />
	<div style="display: none; padding-top: 5px" id="pfield2">Visibile per...
	<table style="width: 95%; margin-top: 5px; margin-left: auto; margin-right: auto">
	<tr>
		<td style="width: 70%; border-bottom: 1px dotted">Genitori</td>
		<td style="width: 30%; text-align: right; border-bottom: 1px dotted"><input type="checkbox" id="par2" value="<?php print GEN_PERM ?>" <?php if(isset($address_perms)){ if($address_perms&GEN_PERM) print "checked='checked'"; } ?> /></td>
	</tr>
	<tr>
		<td style="width: 70%; border-bottom: 1px dotted">Studenti</td>
		<td style="width: 30%; text-align: right; border-bottom: 1px dotted"><input type="checkbox" id="stu2" value="<?php print STD_PERM ?>" <?php if(isset($address_perms)){ if($address_perms&STD_PERM) print "checked='checked'"; } ?> /></td>
	</tr>
	<tr>
		<td style="width: 70%; border-bottom: 1px dotted">ATA</td>
		<td style="width: 30%; text-align: right; border-bottom: 1px dotted"><input type="checkbox" id="ata2" value="<?php print ATA_PERM ?>" <?php if(isset($address_perms)){ if($address_perms&ATA_PERM) print "checked='checked'"; } ?> /></td>
	</tr>
	</table>
	</div>
</div>
</td>
</tr>
<tr>
<td style="">
<div class="field" id="field3">
	<a href="#" onclick="show_t($('pfield3'))" style="font-weight: bolder; font-size: 12px; background-color: #467aa7; height: 12px; color: white">+</a>
	<span style="font-weight: bold; padding-right: 10px">Telefono fisso</span>
	<input type="text" style="border: 1px solid gray; width: 175px; float: right" name="phone" value="<?php if(isset($phone)) print $phone ?>" />
	<div style="display: none; padding-top: 5px" id="pfield3">Visibile per...
	<table style="width: 95%; margin-top: 5px; margin-left: auto; margin-right: auto">
	<tr>
		<td style="width: 70%; border-bottom: 1px dotted">Genitori</td>
		<td style="width: 30%; text-align: right; border-bottom: 1px dotted"><input type="checkbox" id="par3" value="<?php print GEN_PERM ?>" <?php if(isset($phone_perms)){ if($phone_perms&GEN_PERM) print "checked='checked'"; } ?> /></td>
	</tr>
	<tr>
		<td style="width: 70%; border-bottom: 1px dotted">Studenti</td>
		<td style="width: 30%; text-align: right; border-bottom: 1px dotted"><input type="checkbox" id="stu3" value="<?php print STD_PERM ?>" <?php if(isset($phone_perms)){ if($phone_perms&STD_PERM) print "checked='checked'"; } ?> /></td>
	</tr>
	<tr>
		<td style="width: 70%; border-bottom: 1px dotted">ATA</td>
		<td style="width: 30%; text-align: right; border-bottom: 1px dotted"><input type="checkbox" id="ata3" value="<?php print ATA_PERM ?>" <?php if(isset($phone_perms)){ if($phone_perms&ATA_PERM) print "checked='checked'"; } ?> /></td>
	</tr>
	</table>
	</div>
</div>
</td>
</tr>
<tr>
<td style="">
<div class="field" id="field4">
	<a href="#" onclick="show_t($('pfield4'))" style="font-weight: bolder; font-size: 12px; background-color: #467aa7; height: 12px; color: white">+</a>
	<span style="font-weight: bold; padding-right: 10px">Cellulare</span>
	<input type="text" style="border: 1px solid gray; width: 175px; float: right" name="cellphone" value="<?php if(isset($cellphone)) print $cellphone ?>" />
	<div style="display: none; padding-top: 5px" id="pfield4">Visibile per...
	<table style="width: 95%; margin-top: 5px; margin-left: auto; margin-right: auto">
	<tr>
		<td style="width: 70%; border-bottom: 1px dotted">Genitori</td>
		<td style="width: 30%; text-align: right; border-bottom: 1px dotted"><input type="checkbox" id="par4" value="<?php print GEN_PERM ?>" <?php if(isset($cellphone_perms)){ if($cellphone_perms&GEN_PERM) print "checked='checked'"; } ?> /></td>
	</tr>
	<tr>
		<td style="width: 70%; border-bottom: 1px dotted">Studenti</td>
		<td style="width: 30%; text-align: right; border-bottom: 1px dotted"><input type="checkbox" id="stu4" value="<?php print STD_PERM ?>" <?php if(isset($cellphone_perms)){ if($cellphone_perms&STD_PERM) print "checked='checked'"; } ?> /></td>
	</tr>
	<tr>
		<td style="width: 70%; border-bottom: 1px dotted">ATA</td>
		<td style="width: 30%; text-align: right; border-bottom: 1px dotted"><input type="checkbox" id="ata4" value="<?php print ATA_PERM ?>" <?php if(isset($cellphone_perms)){ if($cellphone_perms&ATA_PERM) print "checked='checked'"; } ?> /></td>
	</tr>
	</table>
	</div>
</div>
</td>
</tr>
</table>
<table style="width: 50%; float: right">
<tr>
<td style="">
<div class="field" id="field5">
	<a href="#" onclick="show_t($('pfield5'))" style="font-weight: bolder; font-size: 12px; background-color: #467aa7; height: 12px; color: white">+</a>
	<span style="font-weight: bold; padding-right: 10px">Email</span>
	<input type="text" style="border: 1px solid gray; width: 175px; float: right" name="email"  value="<?php if(isset($email)) print $email ?>" />
	<div style="display: none; padding-top: 5px" id="pfield5">Visibile per...
	<table style="width: 95%; margin-top: 5px; margin-left: auto; margin-right: auto">
	<tr>
		<td style="width: 70%; border-bottom: 1px dotted">Genitori</td>
		<td style="width: 30%; text-align: right; border-bottom: 1px dotted"><input type="checkbox" id="par5" value="<?php print GEN_PERM ?>" <?php if(isset($email_perms)){ if($email_perms&GEN_PERM) print "checked='checked'"; } ?> /></td>
	</tr>
	<tr>
		<td style="width: 70%; border-bottom: 1px dotted">Studenti</td>
		<td style="width: 30%; text-align: right; border-bottom: 1px dotted"><input type="checkbox" id="stu5" value="<?php print STD_PERM ?>" <?php if(isset($email_perms)){ if($email_perms&STD_PERM) print "checked='checked'"; } ?> /></td>
	</tr>
	<tr>
		<td style="width: 70%; border-bottom: 1px dotted">ATA</td>
		<td style="width: 30%; text-align: right; border-bottom: 1px dotted"><input type="checkbox" id="ata5" value="<?php print ATA_PERM ?>" <?php if(isset($email_perms)){ if($email_perms&ATA_PERM) print "checked='checked'"; } ?> /></td>
	</tr>
	</table>
	</div>
</div>
</td>
</tr>
<tr>
<td style="">
<div class="field" id="field6">
	<a href="#" onclick="show_t($('pfield6'))" style="font-weight: bolder; font-size: 12px; background-color: #467aa7; height: 12px; color: white">+</a>
	<span style="font-weight: bold; padding-right: 10px">Messenger</span>
	<input type="text" style="border: 1px solid gray; width: 175px; float: right" name="messenger"  value="<?php if(isset($messenger)) print $messenger ?>" />
	<div style="display: none; padding-top: 5px" id="pfield6">Visibile per...
	<table style="width: 95%; margin-top: 5px; margin-left: auto; margin-right: auto">
	<tr>
		<td style="width: 70%; border-bottom: 1px dotted">Genitori</td>
		<td style="width: 30%; text-align: right; border-bottom: 1px dotted"><input type="checkbox" id="par6" value="<?php print GEN_PERM ?>" <?php if(isset($messenger_perms)){ if($messenger_perms&GEN_PERM) print "checked='checked'"; } ?> /></td>
	</tr>
	<tr>
		<td style="width: 70%; border-bottom: 1px dotted">Studenti</td>
		<td style="width: 30%; text-align: right; border-bottom: 1px dotted"><input type="checkbox" id="stu6" value="<?php print STD_PERM ?>" <?php if(isset($messenger_perms)){ if($messenger_perms&STD_PERM) print "checked='checked'"; } ?> /></td>
	</tr>
	<tr>
		<td style="width: 70%; border-bottom: 1px dotted">ATA</td>
		<td style="width: 30%; text-align: right; border-bottom: 1px dotted"><input type="checkbox" id="ata6" value="<?php print ATA_PERM ?>" <?php if(isset($messenger_perms)){ if($messenger_perms&ATA_PERM) print "checked='checked'"; } ?> /></td>
	</tr>
	</table>
	</div>
</div>
</td>
</tr>
<tr>
<td style="">
<div class="field" id="field7">
	<a href="#" onclick="show_t($('pfield7'))" style="font-weight: bolder; font-size: 12px; background-color: #467aa7; height: 12px; color: white">+</a>
	<span style="font-weight: bold; padding-right: 10px">Sito Web</span>
	<input type="text" style="border: 1px solid gray; width: 175px; float: right"  name="web"  value="<?php if(isset($website)) print $website ?>" />
	<div style="display: none; padding-top: 5px" id="pfield7">Visibile per...
	<table style="width: 95%; margin-top: 5px; margin-left: auto; margin-right: auto">
	<tr>
		<td style="width: 70%; border-bottom: 1px dotted">Genitori</td>
		<td style="width: 30%; text-align: right; border-bottom: 1px dotted"><input type="checkbox" id="par7" value="<?php print GEN_PERM ?>" <?php if(isset($website_perms)){ if($website_perms&GEN_PERM) print "checked='checked'"; } ?> /></td>
	</tr>
	<tr>
		<td style="width: 70%; border-bottom: 1px dotted">Studenti</td>
		<td style="width: 30%; text-align: right; border-bottom: 1px dotted"><input type="checkbox" id="stu7" value="<?php print STD_PERM ?>" <?php if(isset($website_perms)){ if($website_perms&STD_PERM) print "checked='checked'"; } ?> /></td>
	</tr>
	<tr>
		<td style="width: 70%; border-bottom: 1px dotted">ATA</td>
		<td style="width: 30%; text-align: right; border-bottom: 1px dotted"><input type="checkbox" id="ata7" value="<?php print ATA_PERM ?>" <?php if(isset($website_perms)){ if($website_perms&ATA_PERM) print "checked='checked'"; } ?> /></td>
	</tr>
	</table>
	</div>
</div>
</td>
</tr>
<tr>
<td style="">
<div class="field" id="field8">
	<a href="#" onclick="show_t($('pfield8'))" style="font-weight: bolder; font-size: 12px; background-color: #467aa7; height: 12px; color: white">+</a>
	<span style="font-weight: bold; padding-right: 10px">Blog</span>
	<input type="text" style="border: 1px solid gray; width: 175px; float: right" name="blog"  value="<?php if(isset($blog)) print $blog ?>" />
	<div style="display: none; padding-top: 5px" id="pfield8">Visibile per...
	<table style="width: 95%; margin-top: 5px; margin-left: auto; margin-right: auto">
	<tr>
		<td style="width: 70%; border-bottom: 1px dotted">Genitori</td>
		<td style="width: 30%; text-align: right; border-bottom: 1px dotted"><input type="checkbox" id="par8" value="<?php print GEN_PERM ?>" <?php if(isset($blog_perms)){ if($blog_perms&GEN_PERM) print "checked='checked'"; } ?> /></td>
	</tr>
	<tr>
		<td style="width: 70%; border-bottom: 1px dotted">Studenti</td>
		<td style="width: 30%; text-align: right; border-bottom: 1px dotted"><input type="checkbox" id="stu8" value="<?php print STD_PERM ?>" <?php if(isset($blog_perms)){ if($blog_perms&STD_PERM) print "checked='checked'"; } ?> /></td>
	</tr>
	<tr>
		<td style="width: 70%; border-bottom: 1px dotted">ATA</td>
		<td style="width: 30%; text-align: right; border-bottom: 1px dotted"><input type="checkbox" id="ata8" value="<?php print ATA_PERM ?>" <?php if(isset($blog_perms)){ if($blog_perms&ATA_PERM) print "checked='checked'"; } ?> /></td>
	</tr>
	</table>
	</div>
</div>
</td>
</tr>
<tr>
<td colspan="2" style="text-align: right; padding-top: 20px; padding-bottom: 15px">
	<a href="#" onclick="return _submit(document.forms[0])" style="margin-right: 20px">Registra</a>
	<input type="hidden" name="perms" id="perms" />
</td>
</tr>
</table>
</form>
<div class="splitcontentleft">
</div>
</div>
<div id="subcontent">
<?php include 'smallbox.php'; ?>
<?php include "profile_menu.php" ?>
</div>
<?php include "footer.php" ?>
</div>
</body>
</html>